//this js file is used for pop windows.
var popwindow;

function popup(url,name,sizes) 
{  
  if(popwindow != null)
    popwindow.close();

  popwindow = window.open(url,name, sizes);
  return popwindow;
}
function newpopup(url,name,sizes)
{
  if(popwindow != null)
    popwindow.close();
  popwindow = window.open('',name, sizes);
  dispatcherform.target=name;
  dispatcherform.action=url;
  dispatcherform.submit();
  return popwindow;
}
function page_orgselect(rootpath,params,name)
{
  var popurl = rootpath + "masterdata/ogm/OrgSelect.jsp" + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=365, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);
}
function page_orgselectdso(rootpath,params,name)
{
  var popurl = rootpath + "masterdata/ogm/OrgSelectwDSO.jsp" + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=365, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);
}
function page_itemselect(rootpath,params,name)
{
  var popurl = rootpath + "masterdata/pcm/ItemSelectForPO.jsp" + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=450, width=700,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);    
}
function page_itemselect1(rootpath,params,name)
{
  var popurl = rootpath + "masterdata/pcm/ItemSelectForPO1.jsp" + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=450, width=700,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);    
}
function page_itemselect2(rootpath,params,name)
{
  var popurl = rootpath + "masterdata/pcm/ItemSelect.jsp" + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=450, width=700,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);    
}
function page_historypriceselect(rootpath,params,name)
{
  var popurl = rootpath + "ordermanagement/oe/HistoryPrice.jsp" + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=320, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);    
}
function page_desceditpop(rootpath,params,name)
{
  var popurl = rootpath + "common/LangDSO.jsp" + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);    
}
function page_voucherinfo(rootpath,params,name)
{
  var popurl = rootpath + params;
  var popname = "newwindow";
  if(name!=null)
    popname = name;
  var popsize = "height=400, width=800,top=100,left=150,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);
}

function page_questionselect(rootpath, params, name)
{
  var popurl = rootpath + "ordermanagement/csm/QuestionSelectPop.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=380, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);
}

function page_standardtaskselect(rootpath, params, name)
{
  var popurl = rootpath + "masterdata/kdm/StandardTaskSelect.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=380, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);
}
function page_glaccountselect(rootpath, params, name)
{
  var popurl = rootpath + "gl/GLADebit.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=367, width=600,top=50,left=50,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);
}
function page_assaccountselect(rootpath, params, name)
{
  var popurl = rootpath + "gl/GLAssistantItemInit.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=210, width=700,top=50,left=50,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl,popname,popsize);
}
function page_prodconfigpop(rootpath, params, name)
{
  var popurl = rootpath + "masterdata/pcm/ProdConfigPop.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=400, width=700,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl, popname, popsize);
}
function page_prodconfiginvpop(rootpath, params, name)
{
  var popurl = rootpath + "masterdata/pcm/ProdConfigInvPop.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=400, width=700,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  popup(popurl, popname, popsize);
}
function page_voucherinterfacepop(rootpath, params, name)
{
  var popurl = rootpath + "gl/TransVoucherFrm.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=600, width=850,top=50,left=50,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  newpopup(popurl, popname, popsize);
}
function page_vouchertranspop(prepaytype,rootpath, vouchertranstype, transid, randomURL, name)
{
	var myurl;
	switch(Number(vouchertranstype))
	{
		case 1:
			myurl = "fim/SalesInvoiceInfoPop.jsp?invoiceid=";
			break;
		case 2:
			myurl = "crc/popinfo/PurchaseInvoiceInfo.jsp?invoiceid=";
			break;
		case 3:
			myurl = "fim/CollectionFrame.jsp?flag=view&paymentid=";
			break;
		case 4:
			myurl = "fim/CollectionAssignInfoMain.jsp?arapassignid=";
			break;
		case 5:
            myurl = "fim/PaymentFrame.jsp?flag=view&paymentid=";
			break;
		case 6:
			myurl = "fim/PaymentAssignInfoMain.jsp?arapassignid=";
			break;
		case 7:
			myurl = "ordermanagement/ofm/DeliveryInfo.jsp?pop=true&deliveryid=";
			break;
		case 8:
			myurl = "crc/popinfo/ReceiptInfo.jsp?receiptid=";
			break;
		case 9:
			myurl = "iwm/SelfUseSlipInfo.jsp?selfuseslipid=";
			break;
		case 10:
			myurl = "crc/popinfo/ReceiptInfo.jsp?miscreceipt=Y&receiptid=";
			break;
		case 11:
			myurl = "iwm/AdjustmentInfo.jsp?invadjustmentid=";
			break;
		case 12:
			myurl = "iwm/AdjustmentInfo.jsp?invadjustmentid=";
			break;
		case 13:
			myurl = "fim/CostVarianceInfo.jsp?costvardisposeid=";
			break;
		case 14:
			myurl = "crc/popinfo/SalesReturningInfo.jsp?returnid=";
			break;
		case 15:
			myurl = "crc/popinfo/PurchaseReturningInfo.jsp?returnid=";
			break;
		case 16:
			myurl = "iwm/TransferInfo.jsp?transferid=";
			break;
		case 17:
			myurl = "salesmanagement/van/VANInfoFrm.jsp?vansalesslipid=";
			break;
		case 18:
			myurl = "salesmanagement/van/VANInfoFrm.jsp?vansalesslipid=";
			break;
		case 19:
			myurl = "fim/ExpenseFrm.jsp?displayflag=view&expenseslipid=";
			break;
		case 20:
			myurl = "fim/ARAdjustmentInfo.jsp?arapadjustmentid=";
			break;
		case 21:
			myurl = "fim/APAdjustmentInfo.jsp?arapadjustmentid=";
			break;
		case 22:
			myurl = "salesmanagement/van/VANInfoFrm.jsp?vansalesslipid=";
			break;
		case 23:
			myurl = "ordermanagement/oe/SalesOrderViewFrm.jsp?orderid=";
			break;
        case 27:
                myurl = "iwm/InvWorkOrderFrmPop.jsp?trantype=37&flag=view&workorderid=";
                break;
        case 28:
                myurl = "iwm/InvWorkOrderFrmPop.jsp?flag=view&workorderid=";
                break;
        case 29:
                myurl = "fim/fa/FACardEditFrm.jsp?displayflag=view&fixedassetsid=";
                break;
        case 30:

        case 31:
                myurl = "fim/fa/FADeprCalcEditFrm.jsp?displayflag=view&fadeprrequestid=";
                break;
        case 32:
                myurl = "fim/fa/FACardReduceEditFrm.jsp?displayflag=view&fareducedetailid=";
                break;
        case 34:
                myurl="arm/RRSlipFrm.jsp?displayflag=view&rebatetype=2&rebaterequestid=";
                break;
        case 35:
            myurl="arm/RRSlipFrm.jsp?displayflag=view&rebatetype=1&rebaterequestid=";
            break;
        case 36:
                myurl="tpm/MarketingAgreementEdit.jsp?opFlag=view&marketingagreementperiodid=";
                break;
        case 37:
                myurl = "fim/fa/FACardAlterationEditFrm.jsp?displayflag=view&faalterdetailid=";
                break;

        case 40:
			myurl = "iwm/InvWorkOrderFrmPop.jsp?trantype=40&flag=view&workorderid=";
			break;
		case 41:
			myurl = "iwm/InvWorkOrderFrmPop.jsp?trantype=41&flag=view&workorderid=";
			break;
		case 42:
			myurl = "iwm/InvWorkOrderFrmPop.jsp?trantype=42&flag=view&workorderid=";
			break;
		case 43:
			myurl = "iwm/InvWorkOrderFrmPop.jsp?trantype=43&flag=view&workorderid=";
			break;


		default:
			alert("vouchertranstype = " + vouchertranstype);
			return;;		
	}
  var popurl = rootpath + myurl + transid + "&" + randomURL;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=600, width=850,top=50,left=50,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  
  newpopup(popurl, popname, popsize);
}
function page_ovallangpop(rootpath, params, name)
{
  var popurl = rootpath + "/common/OvalLang.jsp" + params;
  var popname = "newwindow";
  if (name != null) popname = name;
  var popsize = "height=200, width=350,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";

  popup(popurl, popname, popsize);
}
